Repository navigation
fix: never record a review the inventory cannot read back - #343
Open
vinceblock99 wants to merge 1 commit into
Open
vinceblock99 wants to merge 1 commit into
vinceblock99 wants to merge 1 commit into
Conversation
Two limits were enforced only when stored reviews are read, so a review could be recorded successfully and then make the whole inventory unreadable. Entries under publication-reviews/ cannot be deleted, so there was no way back. - Size. The 1 MiB bound is defined on the compact signed document, but the artifact was stored pretty-printed, about a third larger. A review whose compact form was over roughly 770 KiB passed prepare, was recorded, and was then refused on every read. - Count. The inventory refuses to list more than 4096 artifacts, but recording the 4097th succeeded. Recording now stores the compact document, admits the bytes exactly as the reader will before writing them, and refuses a new artifact when the inventory is full. Both refusals happen before anything is created on disk or in the vault. Reviews already stored pretty-printed stay as they are, and recording one of them again remains a no-op.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Two limits were enforced only when stored reviews are read. A review could be recorded successfully and then make the whole inventory unreadable. Entries under
publication-reviews/cannot be deleted, so there was no way back.prepare, was recorded, and was then refused on every read.Fix
record_publication_reviewnow:Both refusals happen before anything is created on disk or in the vault.
Reviews already stored pretty-printed stay as they are, and recording one of them again remains a no-op. The content address does not depend on the stored encoding, so no address changes.
Tests
publication_review::tests::storage:deva 9,112 byte document was stored as 13,050 bytes.devthe 4097th record succeeded.cargo test -p atomic-repository --features review-shacl --lib publication_review: 46 passed, 0 failed.